home *** CD-ROM | disk | FTP | other *** search
/ Merciful 5 / Merciful - Disc 5.iso / software / h / hypertextdatav40.12cr.lha / HTDS / S / man
Encoding:
AmigaDOS Script File  |  1997-03-22  |  2.0 KB  |  95 lines

  1. .key FILE/A,SECTION
  2. .bra {
  3. .ket }
  4.  
  5. ;
  6. ; $PROJECT: unix manual page CLI command using MultiView and man.datatype
  7. ;
  8. ; $VER: man 40.3 (21.03.97)
  9. ; by
  10. ;
  11. ; Stefan Ruppert , Windthorststrasse 5 , 65439 Floersheim , GERMANY
  12. ;
  13. ; (C) Copyright 1994-1996
  14. ; All Rights Reserved !
  15. ;
  16. ; $FUNCTION:
  17. ;
  18. ; This command searches for a given string and if it found a entry, it opens
  19. ; a MultiView window to display it (The man.datatype have to be installed) !
  20. ;
  21. ; Set the MANPATH environment variable to the root directory for the man pages.
  22. ;
  23. ;
  24. ; $HISTORY:
  25. ;
  26. ; 21.03.97 : 040.003 : changed to new ADE environment
  27. ; 29.08.96 : 040.002 : fixed a bug in List command
  28. ; 01.03.96 : 040.001 : some cleanup and a date check for mandb added
  29. ; 19.11.94 : 001.002 : now uses [0-9] pattern as suffix
  30. ; 18.11.94 : 001.001 : initial
  31. ;
  32.  
  33. Set MANDB mandb
  34. GetEnv >NIL: MANPATH
  35. If WARN
  36.     Set MPATH ADE:man/
  37. Else
  38.     set MPATH $MANPATH
  39. Endif
  40.  
  41. ;
  42. ; little date check and if something is newer than the $MANDB delete MANDB.
  43. ; So that it is generated new.
  44. ;
  45.  
  46. SetEnv MANCHECK X
  47. Set MANDATE `List $MPATH$MANDB LFORMAT "%d"`
  48. List $MPATH P=~($MANDB) SINCE $MANDATE LFORMAT "%s" >>ENV:MANCHECK
  49. If NOT "$MANCHECK" EQ "X"
  50.     ; only generate one new $MANDB per day
  51.     GetEnv >NIL: MANCHECKED
  52.     If WARN
  53.         Delete >NIL: $MPATH$MANDB
  54.         SetEnv MANCHECKED TRUE
  55.     Endif
  56. Endif
  57.  
  58. If NOT EXISTS $MPATH$MANDB
  59.     Set OLDDIR `cd`
  60.     cd $MPATH
  61.     list cat? P=#?.[0-9](%|.gz) ALL FILES LFORMAT "%s%s" >$MANDB
  62.     cd $OLDDIR
  63. endif
  64.  
  65. if NOT EXISTS $MPATH$MANDB
  66.     Echo "Can't find man database !"
  67.     quit 10
  68. endif
  69.  
  70. if NOT "{section}" EQ ""
  71.     search $MPATH$MANDB #?{section}/{file}.[0-9] PATTERN NONUM >ENV:MAN
  72.     if "$MAN" EQ ""
  73.         Echo "no manual entry in section {section} found !"
  74.     endif
  75. else
  76.     search $MPATH$MANDB /{file}.[0-9] PATTERN NONUM >ENV:MAN
  77.     if "$MAN" EQ ""
  78.         Echo "no manual entry found !"
  79.     endif
  80. endif
  81.  
  82. ; if something is found , display it via MultiView
  83. if NOT "$MAN" EQ ""
  84.     run >NIL: <NIL: MultiView $MPATH$MAN PUBSCREEN `GetPubName`
  85. endif
  86.  
  87. ; cleanup
  88. unsetenv MAN
  89. unsetenv MANCHECK
  90. unset MPATH
  91. unset MANDB
  92. unset MANDATE
  93. unset OLDDIR
  94.  
  95.